package grape.house.rest.estatelicence.mvc;

import grape.common.rest.mvc.BaseController;
import grape.common.rest.mvc.SuperController;
import grape.house.rest.estatelicence.vo.EstateLicenceVo;
import grape.house.service.estatelicence.api.IEstateLicenceService;
import grape.house.service.estatelicence.po.EstateLicence;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * Created by yangwei
 * Created at 2020/9/29 16:12
 */
@RestController
@RequestMapping("/house/estatelicence")
@ApiIgnore
public class EstateLicenceInnerController extends BaseController<EstateLicenceVo, EstateLicence> {

    @Autowired
    private IEstateLicenceService iEstateLicenceService;
    @Autowired
    private TransBuildingPresalePermitVoHelper transBuildingPresalePermitVoHelper;


    @GetMapping("/inner/getEstateLicenceById")
    public EstateLicence getEstateLicenceById(String id){
        return iEstateLicenceService.getById(id);
    }

    @GetMapping("/inner/getEstateLicenceVoById")
    public EstateLicenceVo getEstateLicenceVoById(String id){
        return queryById(id);
    }

    @GetMapping("/inner/getEstateLicenceByEstateId")
    public List<EstateLicence> getEstateLicenceByEstateId(String estateId){
        return iEstateLicenceService.getByEstateId(estateId);
    }
    @GetMapping("/inner/getEstateLicenceByEstateIdAndPropertyTypeId")
    public List<EstateLicence> getEstateLicenceByIdAndPropertyTypeId(String estateId,String propertyTypeId){
        return iEstateLicenceService.getByEstateIdAndPermitTypeDictId(estateId,propertyTypeId);
    }


    @Override
    public EstateLicenceVo transVo(EstateLicenceVo estateLicenceVo) {
        estateLicenceVo = transBuildingPresalePermitVoHelper.transVo(estateLicenceVo);
        return super.transVo(estateLicenceVo);
    }
}
